﻿

using System;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace BTS.Testing.TraceMonitor
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Starting the trace monitor service");
            var baseAddress = new Uri(string.Format("http://localhost:{0}/TraceControlService", Config.WcfServicePort));


            using (var host = new ServiceHost(typeof(TraceControlService), baseAddress))
            {
                var smb = new ServiceMetadataBehavior();
                smb.HttpGetEnabled = true;
                smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
                host.Description.Behaviors.Add(smb);

                host.Open();

                Console.WriteLine("The service is ready at {0}", baseAddress);
                Console.WriteLine("Press <Enter> to stop the service.");
                Console.ReadLine();

                EventTraceManager.Stop();
                host.Close();
            }
        }
    }
}
